﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UPMS.Core.Domain.Mapping;

namespace UPMS.Core.Domain
{
    public class UpmsContext : DbContext
    {
        public UpmsContext()
            : base("UpmsContext")
        {
        }
        public DbSet<Host> Hosts { get; set; }
        public DbSet<Application> Applications { get; set; }
        public DbSet<Module> Modules { get; set; }
        public DbSet<Group> Groups { get; set; }
        public DbSet<Role> Roles { get; set; }
        public DbSet<Permission> Permissions { get; set; }
        public DbSet<Organization> Organizations { get; set; }
        public DbSet<Department> Departments { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<Account> Accounts { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new HostMap());
            modelBuilder.Configurations.Add(new ApplicationMap());
            modelBuilder.Configurations.Add(new ModuleMap());
            modelBuilder.Configurations.Add(new GroupMap());
            modelBuilder.Configurations.Add(new RoleMap());
            modelBuilder.Configurations.Add(new PermissionMap());

            modelBuilder.Configurations.Add(new OrganizationMap());

            modelBuilder.Configurations.Add(new DepartmentMap());

            modelBuilder.Configurations.Add(new UserMap());
            modelBuilder.Configurations.Add(new AccountMap());
        }
    }

}
